<?php
/**
 * Created by Veyron
 * User: Vy
 * motto:现在的拼搏 为了更好的明天
 * day:  2020/1/13
 * Time: 23:01
 */
namespace app\common\business;
use \app\common\model\mysql\Demo as DemoModel;
class Demo{

    public function getDemoDataByCategory($category_id,$limit=10){
        $model = new DemoModel();
        $result = $model->getDemoDataByCategory($category_id,$limit=10);
        if(empty($result)){
            return [];
        }
        $categorys = config('category');
        foreach ($result as $k=>$value){
            $result[$k]['categoryName'] = isset($categorys[$value['category_id']])??'其他';
        }
        return $result;
    }
}
